/**
 * @description 路由路径
 * @author LI
 * @date 2020-11-24 16:15
 */

import { RouteRecordRaw } from 'vue-router'

const frameIn: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: { name: 'homeList' },
    name: 'Home',
    component:  () => import('@/views/Home'),
    children: [
      {
        path: 'login',
        name: 'login',
        meta: { title: '登录' },
        component: () => import('@/views/sys/login')
      },
      {
        path: 'homeList',
        name: 'homeList',
        meta: { auth: true, title: '首页' },
        component: () => import('@/views/page/homeList')
      },
      {
        path: 'register',
        name: 'register',
        meta: { title: '注册' },
        component: () => import('@/views/sys/register')
      },
      {
        path: 'editUserInfo',
        name: 'editUserInfo',
        meta: { auth: true, title: '编辑个人中心' },
        component: () => import('@/views/page/editUserInfo')
      },
      {
        path: 'content',
        name: 'content',
        meta: { auth: true, title: '内容' },
        component: () => import('@/views/page/content')
      },
      {
        path: 'traffic',
        name: 'traffic',
        meta: { title: '领取流量' },
        component: () => import('@/views/sys/traffic')
      }
    ]
  }
]

const errorPage: Array<RouteRecordRaw> = [
  {
    path: '/:pathMatch(.*)*',
    name: '404',
    component: () => import('@/views/sys/404')
  }
]

// 重新组织后导出
export const routes: Array<RouteRecordRaw> = [
  ...frameIn,
  ...errorPage
]
